package org.sunrise.game.client.main.frame;

import javax.swing.*;

public class SettingManager {
    private static String[] themes = {
            "NoireLookAndFeel",
            "SmartLookAndFeel",
            "MintLookAndFeel",
            "McWinLookAndFeel",
            "LunaLookAndFeel",
            "HiFiLookAndFeel",
            "FastLookAndFeel",
            "BernsteinLookAndFeel",
            "AluminiumLookAndFeel",
            "AeroLookAndFeel",
            "GraphiteLookAndFeel"
    };

    public static void changeTheme(JFrame frame) {
        String selectedTheme = (String) JOptionPane.showInputDialog(
                frame,
                "选择主题:",
                "更改主题",
                JOptionPane.PLAIN_MESSAGE,
                null,
                themes,
                themes[0]
        );

        if (selectedTheme != null) {
            try {
                switch (selectedTheme) {
                    case "NoireLookAndFeel":
                        UIManager.setLookAndFeel("com.jtattoo.plaf.noire.NoireLookAndFeel");
                        break;
                    case "SmartLookAndFeel":
                        UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");
                        break;
                    case "MintLookAndFeel":
                        UIManager.setLookAndFeel("com.jtattoo.plaf.mint.MintLookAndFeel");
                        break;
                    case "McWinLookAndFeel":
                        UIManager.setLookAndFeel("com.jtattoo.plaf.mcwin.McWinLookAndFeel");
                        break;
                    case "LunaLookAndFeel":
                        UIManager.setLookAndFeel("com.jtattoo.plaf.luna.LunaLookAndFeel");
                        break;
                    case "HiFiLookAndFeel":
                        UIManager.setLookAndFeel("com.jtattoo.plaf.hifi.HiFiLookAndFeel");
                        break;
                    case "FastLookAndFeel":
                        UIManager.setLookAndFeel("com.jtattoo.plaf.fast.FastLookAndFeel");
                        break;
                    case "BernsteinLookAndFeel":
                        UIManager.setLookAndFeel("com.jtattoo.plaf.bernstein.BernsteinLookAndFeel");
                        break;
                    case "AluminiumLookAndFeel":
                        UIManager.setLookAndFeel("com.jtattoo.plaf.aluminium.AluminiumLookAndFeel");
                        break;
                    case "AeroLookAndFeel":
                        UIManager.setLookAndFeel("com.jtattoo.plaf.aero.AeroLookAndFeel");
                        break;
                    case "GraphiteLookAndFeel":
                        UIManager.setLookAndFeel("com.jtattoo.plaf.graphite.GraphiteLookAndFeel");
                        break;
                }
                SwingUtilities.updateComponentTreeUI(frame);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
}
